package book_management.user;

import book_management.operation.IOperation;
import book_management.operation.ipml.BorrowOperation;
import book_management.operation.ipml.DisplayAllBooks;
import book_management.operation.ipml.FindOperation;
import book_management.operation.ipml.ReturnOperation;

import java.util.Scanner;

public class NormalUser extends User{
    private Scanner scanner = new Scanner(System.in);
    public NormalUser (String name){
        this.name = name;
        this.operations = new IOperation[]{//这还是个数组宝儿，写分号干嘛

                new DisplayAllBooks(),

                new FindOperation(),

                new BorrowOperation(),

                new ReturnOperation()
        };
    }
    @Override
    public int menu() {
        System.out.println("==========================");
        System.out.println("欢迎" + name + "来这玩儿！！！");
        System.out.println("1.显示当前书籍列表");
        System.out.println("2.查询书籍");
        System.out.println("3.借阅书籍");
        System.out.println("4.归还书籍");
        System.out.println("-1.退出系统");
        System.out.println("选一下把，宝儿~");
        int choice = scanner.nextInt();
        if(choice == -1) {
            scanner.close();
        }
        System.out.println("==========================");
        return choice;
    }
}
